// 所有模块信息的配置项
export const allInfoTypes = [
  {
    key: 'userInfo',
    label: '个人信息',
  },
  {
    key: 'reserveInfo',
    label: '预约信息',
  },
]
// 根据当前类型获取对应的配置项（类型比如：预约类型、预警类型）
export const getInfoTypesByType = function (type: string) {
  let infoTypes: Array<string> = []
  // 预警
  if (type === 'warn') {
    infoTypes = ['userInfo']
  }
  // 预约
  else if (type === 'reserve') {
    infoTypes = ['userInfo', 'reserveInfo']
  }
  return allInfoTypes.filter((it) => {
    return infoTypes.includes(it['key'])
  })
}
export const getColumns = function (type: string) {
  let columnArr: Array<object> = []
  switch (type) {
    // 个人信息
    case 'userInfo':
      columnArr = [
        { field: 'realName', label: '姓  名', span: 12, labelWidth: '60px' },
        { field: 'sexName', label: '性  别', span: 12, labelWidth: '60px' },
        { field: 'code', label: '学  号', span: 24, labelWidth: '60px' },
        { field: 'gradeName', label: '年  级', span: 12, labelWidth: '60px' },
        { field: 'classNo', label: '班  级', span: 12, labelWidth: '60px' },
        { field: 'tenantName', label: '学  校', span: 24, labelWidth: '60px' },
        { field: 'phone', label: '联系方式', span: 24, labelWidth: '70px' },
      ]
      break
    // 预约信息
    case 'reserveInfo':
      columnArr = [
        { field: 'reserveType', label: '预约类型', span: 24 },
        { field: 'reserveNo', label: '预约编号', span: 24 },
        { field: 'reserveInitiateTime', label: '发起时间', span: 24 },
      ]
      break
  }
  return columnArr
}

// 获取接口信息
export const getUrl = function (hdType: string, btnType: string) {
  let urls: any = {
    // 预警类型
    warn: {
      // 提交
      submit: '/api/blade-measure/measure/userprojectgauge/saveInterveneInfo',
    },
  }
  return urls[hdType][btnType]
}
